﻿// use_2_tfbl.cpp: 实现文件
//

#include "pch.h"
#include "HoManSys1.h"
#include "use_2_tfbl.h"
#include "afxdialogex.h"
#include "ADOconnection.h"

// use_2_tfbl 对话框
ADOconnection conne;
IMPLEMENT_DYNAMIC(use_2_tfbl, CDialogEx)

use_2_tfbl::use_2_tfbl(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DIALOG_tfbl, pParent)
	, m_ddh(_T(""))
	, m_fjh(_T(""))
{

}

use_2_tfbl::~use_2_tfbl()
{
}

void use_2_tfbl::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Text(pDX, IDC_EDIT1, m_ddh);
	DDX_Text(pDX, IDC_EDIT2, m_fjh);
}


BEGIN_MESSAGE_MAP(use_2_tfbl, CDialogEx)
	ON_BN_CLICKED(IDC_BUTTON1, &use_2_tfbl::OnBnClickedButton1)
END_MESSAGE_MAP()


// use_2_tfbl 消息处理程序


void use_2_tfbl::OnBnClickedButton1()
{
	// TODO: 在此添加控件通知处理程序代码
	
	UpdateData();
	conne.DBConnection();
	m_pQr.CreateInstance(__uuidof(Recordset));
	m_pQr->Open(_bstr_t(_T("select * from exi")), conne.m_pCon.GetInterfacePtr(), adOpenDynamic, adLockOptimistic, adCmdText);



	m_pQr->AddNew();
	m_pQr->PutCollect(_variant_t(_T("orderID")), _variant_t(m_ddh));
	
	m_pQr->PutCollect(_variant_t(_T("roomID")), _variant_t(m_fjh));

	m_pQr->Update();
	m_pQr->Close();
	MessageBox(_T("欢迎下次光临！"));
}
